﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            int sum = 0;
            int max = 0;
            int min = 0;
            int avg = 0;
            Sz(ref max, ref min, ref avg);
            Console.ReadKey();
            Sz2(out max, out min, out avg);
            Console.ReadKey();
            Console.ForegroundColor = ConsoleColor.Red;
            Student student = new Student("孙悟空");
            Student student1 = new Student("沙和尚");
            Student student2 = new Student("猪八戒");
            Student student3 = new Student("白龙马");
            student.print();
            Console.ForegroundColor = ConsoleColor.Yellow;
            student1.print();
            Console.ForegroundColor = ConsoleColor.Blue;
            student2.print();
            Console.ForegroundColor = ConsoleColor.White;
            student3.print();
            Console.ForegroundColor = ConsoleColor.Red;
            Student.ceteacher();
            student.print();
            Console.ForegroundColor = ConsoleColor.Yellow;
            student1.print();
            Console.ForegroundColor = ConsoleColor.Blue;
            student2.print();
            Console.ForegroundColor = ConsoleColor.White;
            student3.print();
            Console.ReadKey();
        }



        public static int Sz(ref int max, ref int min, ref int avg)
        {
            int[] a = new int[5];
            int sum = 0;
            for (int i = 0; i < a.Length; i++)
            {
                Console.WriteLine("请输入第{0}个数据", (i + 1));
                int b = int.Parse(Console.ReadLine());
                a[i] = b;
                sum = sum + a[i];
            }

            Array.Sort(a);
            max = a[4];
            min = a[0];
            avg = sum / 5;
            Console.WriteLine("和是{0}，最大值是{1}，最小值是{2}，平均值是{3}", sum, max, min, avg);
            return sum;
        }
        public static int Sz2(out int max, out int min, out int avg)
        {
            int[] a = new int[5];
            int sum = 0;
            for (int i = 0; i < a.Length; i++)
            {
                Console.WriteLine("请输入第{0}个数据", (i + 1));
                int b = int.Parse(Console.ReadLine());
                a[i] = b;
                sum = sum + a[i];
            }
            Array.Sort(a);
            max = a[4];
            min = a[0];
            avg = sum / 5;
            Console.WriteLine("和是{0}，最大值是{1}，最小值是{2}，平均值是{3}", sum, max, min, avg);
            return sum;
        }
    }
}